################# BASIC II ASSIGNMENT ##############

			#### 1 ###

array = [3,5,1,2,7,9,8,13,25,32]
sum = 0
array.each{|i| sum +=i}
# puts sum
# puts array.find_all{|i| i>10}
									#OR YOU CAN USE INJECT

array0 = [3,5,1,2,7,9,8,13,25,32]
# puts array0.inject(0){|sum,i| sum + i}


			### 2 ###

array2 = ['John', 'KB', 'Oliver', 'Cory', 'Matthew', 'Christopher']
#puts array2.shuffle
#puts array2.find_all{|i| i.length>5}

			### 3 ###


array3 = ('a'..'z').to_a
array3.shuffle.last
first = array3.shuffle.first
if(first == 'a' || first == 'e' || first == 'i' || first == 'o' ||first == 'u')
	#puts 'First letter is vowel'
else
	#puts first
end

			### 4 ###
array4 = []
rand_num = 10.times do 
	array4.push rand(55..100)
end
# puts myarray.inspect

			### 5 ###
array5 = []
rand_num = 10.times do 
	array5.push rand(55..100)
end
 array5_1 = array5.sort  #######.sort is equivalent to .sort{|x,y| x<=>y}   check positions for x and y 
#puts array5.sort{|x,y| y<=>x}.inspect  #######SORT FROM LARGE to SMALL 
 array5_1.sort[9]    ##### OR array5_1.sort[-1] -> -1 finding the last number in array
 array5_1.sort[0]

			### 6 ###
(65+rand(26)).chr  ####  random number between 0 and 25 that adds to 65 to give range from 65 to 90 which .chr converts to A-Z (ASCII)
array6= []
rand_char = 5.times do
	array6.push (65+rand(26)).chr
end
#puts array6.to_s
rand_string =(1..5).map {(65+rand(26)).chr}
#puts rand_string.to_s

			### 7 ###
array7=[]
rand_strings = 10.times do
	array7.push (1..5).map {(65+rand(26)).chr}
end
puts array7.to_a.inspect

